home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / winterp-1.13 / src-server / wc_XmGraph.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-04  |  33.8 KB  |  1,100 lines

  1. /* -*-C-*-
  2. ********************************************************************************
  3. *
  4. * File:         wc_XmGraph.c
  5. * RCS:          $Header: wc_XmGraph.c,v 1.4 91/03/15 01:13:03 mayer Exp $
  6. * Description:  Interface to HP's "Graph Widget" -- this widget is currently
  7. *               available only within HP, but may be offered in HP's MotifPlus
  8. *               user-contributed package. Within HP, you can get XmGraph by doing
  9. *               'ninstall -vhhplday XmGraph'...
  10. * Author:       Niels Mayer & Audrey Ishizaki, HPLabs
  11. * Created:      Sun Feb 18 19:32:38 1990
  12. * Modified:     Thu Oct  3 22:56:04 1991 (Niels Mayer) mayer@hplnpm
  13. * Language:     C
  14. * Package:      N/A
  15. * Status:       X11r5 contrib tape release
  16. *
  17. * WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  18. * XLISP version 2.1, Copyright (c) 1989, by David Betz.
  19. *
  20. * Permission to use, copy, modify, distribute, and sell this software and its
  21. * documentation for any purpose is hereby granted without fee, provided that
  22. * the above copyright notice appear in all copies and that both that
  23. * copyright notice and this permission notice appear in supporting
  24. * documentation, and that the name of Hewlett-Packard and David Betz not be
  25. * used in advertising or publicity pertaining to distribution of the software
  26. * without specific, written prior permission.  Hewlett-Packard and David Betz
  27. * make no representations about the suitability of this software for any
  28. * purpose. It is provided "as is" without express or implied warranty.
  29. *
  30. * HEWLETT-PACKARD AND DAVID BETZ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
  31. * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  32. * IN NO EVENT SHALL HEWLETT-PACKARD NOR DAVID BETZ BE LIABLE FOR ANY SPECIAL,
  33. * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  34. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  35. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  36. * PERFORMANCE OF THIS SOFTWARE.
  37. *
  38. * See ./winterp/COPYRIGHT for information on contacting the authors.
  39. * Please send modifications, improvements and bugfixes to mayer@hplabs.hp.com
  40. * Post XLISP-specific questions/information to the newsgroup comp.lang.lisp.x
  41. *
  42. ********************************************************************************
  43. */
  44. static char rcs_identity[] = "@(#)$Header: wc_XmGraph.c,v 1.4 91/03/15 01:13:03 mayer Exp $";
  45.  
  46. #include <stdio.h>
  47. #include <Xm/Xm.h>
  48. #include <Xm/Graph.h>
  49. #include <Xm/Arc.h>
  50. #include "winterp.h"
  51. #include "user_prefs.h"
  52. #include "xlisp/xlisp.h"
  53. #include "w_funtab.h"
  54.  
  55.  
  56. extern Widget Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(); /* w_classes.c */
  57. extern LVAL true;
  58.  
  59. /******************************************************************************
  60.  ******************************************************************************/
  61. static LVAL Wcxmg_WidgetList_To_Lisp_Vector(wlist, size)
  62.      WidgetList wlist;
  63.      int        size;
  64. {
  65.   extern LVAL Wcls_WidgetID_To_WIDGETOBJ(); /* w_classes.c */
  66.   LVAL result;
  67.   int i;
  68.   
  69.   if (!wlist || !size)
  70.     return (NIL);
  71.  
  72.   xlsave1(result);
  73.   result = newvector(size);
  74.   for (i = 0; i < size; i++)
  75.     setelement(result, i, Wcls_WidgetID_To_WIDGETOBJ((wlist[i])));
  76.   xlpop();
  77.   return (result);
  78. }
  79.  
  80.  
  81. /*****************************************************************************
  82.  * (send XM_GRAPH_WIDGET_CLASS :new
  83.  *                           [:managed/:unmanaged]
  84.  *                           [:scrolled]
  85.  *                           [<name>]
  86.  *                           <parent> 
  87.  *                           [:XMN_<arg1> <val1>]
  88.  *                           [. . .             ]
  89.  *                           [:XMN_<argN> <valN>])
  90.  *
  91.  * The optional keyword submessage :managed will cause a subsequent call
  92.  * to XtManageChild(). If the submessage :unmanaged is present, or no
  93.  * submessage, then XtManageChild() won't be called, and the resulting
  94.  * widget will be returned unmanaged.
  95.  *
  96.  *     (send XM_GRAPH_WIDGET_CLASS :new ...)
  97.  *     --> XmCreateGraph();
  98.  *     (send XM_GRAPH_WIDGET_CLASS :new :managed ...)
  99.  *     --> XmCreateManagedGraph();
  100.  *     (send XM_GRAPH_WIDGET_CLASS :new :scrolled ...)
  101.  *     --> XmCreateScrolledGraph();
  102.  *        Note: extra convenience fn XmCreateScrolledGraph() puts the
  103.  *      graph widget inside a scrolled window but returns the graph widget.
  104.  ****************************************************************************/
  105. LVAL Xm_Graph_Widget_Class_Method_ISNEW()
  106. {
  107.   extern ArgList Wres_Get_LispArglist(); /* from w_resources.c */
  108.   extern void    Wres_Free_C_Arglist_Data(); /* from w_resources.c */
  109.   extern LVAL k_managed, k_unmanaged, k_scrolled;
  110.   LVAL self, o_parent;
  111.   char* name;
  112.   Boolean managed_p, scrolled_p;
  113.   Widget parent_widget_id, widget_id;
  114.  
  115.   self = xlgaobject();        /* NOTE: xlobj.c:clnew() returns an OBJECT; if this method
  116.                    returns successfully, it will return a WIDGETOBJ */
  117.  
  118.   /* get optional managed/unmanaged arg */
  119.   if (moreargs() && ((*xlargv == k_managed) || (*xlargv == k_unmanaged)))
  120.     managed_p = (nextarg() == k_managed);
  121.   else
  122.     managed_p = FALSE;        /* by default don't call XtManageChild() */
  123.  
  124.   /* get optional :scrolled arg */
  125.   if (moreargs() && (*xlargv == k_scrolled)) {
  126.     nextarg();
  127.     scrolled_p = TRUE;
  128.   }
  129.   else
  130.     scrolled_p = FALSE;        /* by default, we don't want a scroled graphwidget */
  131.  
  132.   /* get optional <name> arg */
  133.   if (moreargs() && (stringp(*xlargv)))
  134.     name = (char*) getstring(nextarg());
  135.   else
  136.     name = "";            /* default name */
  137.  
  138.   /* get required <parent> widget-object arg */
  139.   parent_widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&o_parent);
  140.  
  141.   /*
  142.    * Store the widget object <self> in the XmNuserData resource on the
  143.    * widget. This will allow us to retrieve the widget object from Xtoolkit
  144.    * functions returning widget ID's without having to keep around a table
  145.    * of widgetID-->widget-objects.
  146.    */
  147.    ARGLIST_RESET(); ARGLIST_ADD(XmNuserData, (XtArgVal) self); 
  148.  
  149.   if (moreargs()) {        /* if there are more arguments, */
  150.     Cardinal xt_numargs;    /* then we have some extra widget resources to set */
  151.     ArgList xt_arglist = Wres_Get_LispArglist(self, parent_widget_id, ARGLIST(), &xt_numargs);
  152.     if (scrolled_p)
  153.       widget_id = XmCreateScrolledGraph(parent_widget_id, name, xt_arglist, xt_numargs);
  154.     else
  155.       widget_id = XmCreateGraph(parent_widget_id, name, xt_arglist, xt_numargs);
  156.     Wres_Free_C_Arglist_Data();
  157.   }
  158.   else 
  159.     if (scrolled_p)
  160.       widget_id = XmCreateScrolledGraph(parent_widget_id, name, ARGLIST());
  161.     else
  162.       widget_id = XmCreateGraph(parent_widget_id, name, ARGLIST());
  163.  
  164.   Wcls_Initialize_WIDGETOBJ(self, widget_id);
  165.  
  166.   if (managed_p)
  167.     XtManageChild(widget_id);
  168.  
  169. #ifdef DEBUG_WINTERP_1
  170.   Wcls_Print_WidgetObj_Info(self);
  171. #endif
  172.   return (self);
  173. }
  174.  
  175.  
  176. /*****************************************************************************
  177.  * (send XM_ARC_WIDGET_CLASS :new
  178.  *                           [:managed/:unmanaged]
  179.  *                           [:scrolled]
  180.  *                           [<name>]
  181.  *                           <parent> 
  182.  *                           [:XMN_<arg1> <val1>]
  183.  *                           [. . .             ]
  184.  *                           [:XMN_<argN> <valN>])
  185.  *
  186.  * The optional keyword submessage :managed will cause a subsequent call
  187.  * to XtManageChild(). If the submessage :unmanaged is present, or no
  188.  * submessage, then XtManageChild() won't be called, and the resulting
  189.  * widget will be returned unmanaged.
  190.  *
  191.  *     (send XM_ARC_WIDGET_CLASS :new ...)
  192.  *     --> XmCreateArc();
  193.  *     (send XM_GRAPH_WIDGET_CLASS :new :managed ...)
  194.  *     --> XmCreateArc();
  195.  *
  196.  * Note: the arc widget is kind of weird... it should only be created by the
  197.  * "convenience function" XmCreateArc() which always creates a managed arc.
  198.  * Thus, the argument :managed or :unmanaged is completely ignored here.
  199.  * Not anymore, with doug's latest XmGraph...
  200.  ****************************************************************************/
  201. LVAL Xm_Arc_Widget_Class_Method_ISNEW()
  202. {
  203.   extern ArgList Wres_Get_LispArglist(); /* from w_resources.c */
  204.   extern void    Wres_Free_C_Arglist_Data(); /* from w_resources.c */
  205.   extern LVAL k_managed, k_unmanaged;
  206.   LVAL self, o_parent;
  207.   char* name;
  208.   Boolean managed_p;
  209.   Widget parent_widget_id, widget_id;
  210.  
  211.   self = xlgaobject();        /* NOTE: xlobj.c:clnew() returns an OBJECT; if this method
  212.                    returns successfully, it will return a WIDGETOBJ */
  213.  
  214.   /* get optional managed/unmanaged arg */
  215.   if (moreargs() && ((*xlargv == k_managed) || (*xlargv == k_unmanaged)))
  216.     managed_p = (nextarg() == k_managed);
  217.   else
  218.     managed_p = FALSE;        /* by default don't call XtManageChild() */
  219.     /* for this particular widget creation case we just swallow the arg and ignore it 
  220.        we deal with this arg just for compatibility with other widget creators in WINTERP
  221.        nextarg();
  222.        This changed with the latest XmGraph (aud)
  223.     */
  224.  
  225.   /* get optional <name> arg */
  226.   if (moreargs() && (stringp(*xlargv)))
  227.     name = (char*) getstring(nextarg());
  228.   else
  229.     name = "";            /* default name */
  230.  
  231.   /* get required <parent> widget-object arg */
  232.   parent_widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&o_parent);
  233.  
  234.   /*
  235.    * Store the widget object <self> in the XmNuserData resource on the
  236.    * widget. This will allow us to retrieve the widget object from Xtoolkit
  237.    * functions returning widget ID's without having to keep around a table
  238.    * of widgetID-->widget-objects.
  239.    */
  240.    ARGLIST_RESET(); ARGLIST_ADD(XmNuserData, (XtArgVal) self); 
  241.  
  242.   if (moreargs()) {        /* if there are more arguments, */
  243.     Cardinal xt_numargs;    /* then we have some extra widget resources to set */
  244.     ArgList xt_arglist = Wres_Get_LispArglist(self, parent_widget_id, ARGLIST(), &xt_numargs);
  245.     widget_id = XmCreateArc(parent_widget_id, name, xt_arglist, xt_numargs);
  246.     Wres_Free_C_Arglist_Data();
  247.   }
  248.   else 
  249.     widget_id = XmCreateArc(parent_widget_id, name, ARGLIST());
  250.  
  251.   Wcls_Initialize_WIDGETOBJ(self, widget_id);
  252.   if (managed_p)
  253.     XtManageChild(widget_id);
  254.  
  255. #ifdef DEBUG_WINTERP_1
  256.   Wcls_Print_WidgetObj_Info(self);
  257. #endif
  258.   return (self);
  259. }
  260.  
  261.  
  262. /******************************************************************************
  263.  * typedef struct
  264.  * {
  265.  *    int     reason;
  266.  *    XEvent    *event;
  267.  *    WidgetList     selected_widgets;
  268.  *    int            num_selected_widgets;
  269.  *    WidgetList     selected_arcs;
  270.  *    int            num_selected_arcs;
  271.  *     Widget         widget;
  272.  *    Widget         old_to;
  273.  *    Widget         old_from;
  274.  *    Widget         new_to;
  275.  *    Widget         new_from;
  276.  *    Boolean        doit;
  277.  * } XmGraphCallbackStruct;
  278.  *******************************************************************************/
  279. static LVAL s_CALLBACK_SELECTED_WIDGETS, s_CALLBACK_NUM_SELECTED_WIDGETS,
  280.   s_CALLBACK_SELECTED_ARCS, s_CALLBACK_NUM_SELECTED_ARCS, s_CALLBACK_OLD_TO,
  281.   s_CALLBACK_OLD_FROM, s_CALLBACK_NEW_TO, s_CALLBACK_NEW_FROM;
  282. static void Lexical_Bindings_For_XmGraphCallbackStruct(bindings_list, lexical_env, cd, o_widget)
  283.      LVAL bindings_list;    /* a list of symbols to which values from XmGraphCallbackStruct are bound */
  284.      LVAL lexical_env;        
  285.      XmGraphCallbackStruct* cd;
  286.      LVAL o_widget;        /* XLTYPE_WIDGETOBJ */
  287. {
  288.   extern LVAL s_CALLBACK_WIDGET, s_CALLBACK_REASON, s_CALLBACK_XEVENT; /* w_callbacks.c */
  289.   extern LVAL Wcb_Get_Callback_Reason_Symbol();    /* w_callbacks.c */
  290.   extern LVAL Wcls_WidgetID_To_WIDGETOBJ(); /* w_classes.c */
  291.   register LVAL s_bindname;
  292.  
  293.   for ( ; consp(bindings_list); bindings_list = cdr(bindings_list)) {
  294.  
  295.     s_bindname = car(bindings_list);
  296.  
  297. #ifdef THE_FOLLOWING_CODE_IS_COMMENTED_OUT
  298. fprintf(stderr, "callback_widget: %x\n", o_widget);
  299. fprintf(stderr, "callback_reason: %x\n", cd->reason);
  300. fprintf(stderr, "callback_event: %x\n", cd->event);
  301. fprintf(stderr, "callback_selected_widgets[0]: %x\n", cd->selected_widgets[0]);
  302. fprintf(stderr, "callback_num_selected_widgets: %d\n", cd->num_selected_widgets);
  303. fprintf(stderr, "callback_selected_arcs[0]: %x\n", cd->selected_arcs[0]);
  304. fprintf(stderr, "callback_num_selected_arcs: %d\n", cd->num_selected_arcs);
  305. fprintf(stderr, "callback_old_to: %x\n", cd->old_to);
  306. fprintf(stderr, "callback_old_from: %x\n", cd->old_from);
  307. fprintf(stderr, "callback_new_to: %x\n", cd->new_to);
  308. fprintf(stderr, "callback_new_from: %x\n", cd->new_from);
  309. #endif                /* THE_FOLLOWING_CODE_IS_COMMENTED_OUT */
  310.  
  311.     if (s_bindname == s_CALLBACK_WIDGET) {
  312.       xlpbind(s_bindname, o_widget, lexical_env); /* add binding to lexical_env */
  313.     }
  314.     else if (s_bindname == s_CALLBACK_REASON) {
  315.       xlpbind(s_bindname, Wcb_Get_Callback_Reason_Symbol(cd->reason), lexical_env);
  316.     }
  317.     else if (s_bindname == s_CALLBACK_XEVENT) {
  318.       xlpbind(s_bindname, (cd->event) ? cv_xevent(cd->event) : NIL, lexical_env);
  319.     }
  320.     else if (s_bindname == s_CALLBACK_SELECTED_WIDGETS) {
  321.       xlpbind(s_bindname, Wcxmg_WidgetList_To_Lisp_Vector(cd->selected_widgets, cd->num_selected_widgets), lexical_env);    /* the vector and it's constituent XmStrings may be freed later via gc */
  322.     }
  323.     else if (s_bindname == s_CALLBACK_NUM_SELECTED_WIDGETS) {
  324.       xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->num_selected_widgets), lexical_env);
  325.     }
  326.     else if (s_bindname == s_CALLBACK_SELECTED_ARCS) {
  327.       xlpbind(s_bindname, Wcxmg_WidgetList_To_Lisp_Vector(cd->selected_arcs, cd->num_selected_arcs), lexical_env);    /* the vector and it's constituent XmStrings may be freed later via gc */
  328.     }
  329.     else if (s_bindname == s_CALLBACK_NUM_SELECTED_ARCS) {
  330.       xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->num_selected_arcs), lexical_env);
  331.     }
  332.     else if (s_bindname == s_CALLBACK_OLD_TO) {
  333.       xlpbind(s_bindname, Wcls_WidgetID_To_WIDGETOBJ(cd->old_to), lexical_env);
  334.     }
  335.     else if (s_bindname == s_CALLBACK_OLD_FROM) {
  336.       xlpbind(s_bindname, Wcls_WidgetID_To_WIDGETOBJ(cd->old_from), lexical_env);
  337.     }
  338.     else if (s_bindname == s_CALLBACK_NEW_TO) {
  339.       xlpbind(s_bindname, Wcls_WidgetID_To_WIDGETOBJ(cd->new_to), lexical_env);
  340.     }
  341.     else if (s_bindname == s_CALLBACK_NEW_FROM) {
  342.       xlpbind(s_bindname, Wcls_WidgetID_To_WIDGETOBJ(cd->new_from), lexical_env);
  343.     }
  344.     else {
  345.       extern char temptext[];    /* from winterp.c */
  346.       sprintf(temptext,
  347.           "Unknown binding name in XmGraphCallbackStruct callback evaluator. Valid symbols are [%s %s %s %s %s %s %s %s %s %s %s].",
  348.           (char*) getstring(getpname(s_CALLBACK_WIDGET)),
  349.           (char*) getstring(getpname(s_CALLBACK_REASON)),
  350.           (char*) getstring(getpname(s_CALLBACK_XEVENT)),
  351.           (char*) getstring(getpname(s_CALLBACK_SELECTED_WIDGETS)),
  352.           (char*) getstring(getpname(s_CALLBACK_NUM_SELECTED_WIDGETS)),
  353.           (char*) getstring(getpname(s_CALLBACK_SELECTED_ARCS)),
  354.           (char*) getstring(getpname(s_CALLBACK_NUM_SELECTED_ARCS)),
  355.           (char*) getstring(getpname(s_CALLBACK_OLD_TO)),
  356.           (char*) getstring(getpname(s_CALLBACK_OLD_FROM)),
  357.           (char*) getstring(getpname(s_CALLBACK_NEW_TO)),
  358.           (char*) getstring(getpname(s_CALLBACK_NEW_FROM)));
  359.       xlerror(temptext, s_bindname);
  360.     }
  361.   }
  362. }
  363.  
  364.  
  365. /******************************************************************************
  366.  * This is called indirectly via XtAddCallback() for callbacks returning an
  367.  * XmGraphCallbackStruct as call_data.
  368.  ******************************************************************************/
  369. void XmGraphCallbackStruct_Callbackproc(widget, client_data, call_data)
  370.      Widget    widget;
  371.      XtPointer client_data;
  372.      XtPointer call_data;
  373. {
  374.   extern void Wcb_Meta_Callbackproc(); /* w_callbacks.c */
  375.  
  376.   Wcb_Meta_Callbackproc(client_data, call_data,
  377.             Lexical_Bindings_For_XmGraphCallbackStruct,
  378.             NULL);    /* FIX: the graph callback allows setting of DOIT field */
  379. }
  380.  
  381.  
  382. /*
  383.  * The Graph widget receives the values from XmGraphCallbackStruct:
  384.  * CALLBACK_REASON
  385.  * CALLBACK_EVENT
  386.  * CALLBACK_INTERACTIVE (not available)
  387.  * CALLBACK_SELECTED_WIDGETS (list)
  388.  * CALLBACK_NUM_SELECTED_WIDGETS
  389.  * CALLBACK_SELECTED_ARCS (list)
  390.  * CALLBACK_NUM_SELECTED_ARCS
  391.  * CALLBACK_WIDGET
  392.  * CALLBACK_OLD_TO
  393.  * CALLBACK_OLD_FROM
  394.  * CALLBACK_NEW_TO
  395.  * CALLBACK_NEW_FROM
  396.  * CALLBACK_DOIT  (not available)
  397.  */
  398. LVAL Xm_Graph_Widget_Class_Method_ADD_CALLBACK()
  399. {
  400.   extern LVAL Wcb_Meta_Method_Add_Callback(); /* w_callbacks.c */
  401.  
  402.   return (Wcb_Meta_Method_Add_Callback(XmGraphCallbackStruct_Callbackproc, FALSE));
  403. }
  404.  
  405. LVAL Xm_Graph_Widget_Class_Method_SET_CALLBACK()
  406. {
  407.   extern LVAL Wcb_Meta_Method_Add_Callback(); /* w_callbacks.c */
  408.  
  409.   return (Wcb_Meta_Method_Add_Callback(XmGraphCallbackStruct_Callbackproc, TRUE));
  410. }
  411.  
  412.  
  413. /*
  414.  * (send graph_widget :center_around_widget widget)
  415.  */
  416. LVAL Xm_Graph_Widget_Class_Method_CENTER_AROUND_WIDGET ()
  417. {
  418.   LVAL self, w;
  419.   Widget graph;
  420.   Widget node;
  421.  
  422.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  423.   node = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&w);
  424.   xllastarg();
  425.  
  426.   XmGraphCenterAroundWidget(graph, node);
  427.  
  428.   return (self);            /* NPM */
  429. }
  430. /*
  431.  *
  432.  */
  433. LVAL Xm_Graph_Widget_Class_Method_DESTROY_ALL_ARCS()
  434. {
  435.   LVAL self;
  436.   Widget graph;
  437.  
  438.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  439.   xllastarg();
  440.  
  441.   XmGraphDestroyAllArcs(graph);
  442.  
  443.   return (self);            /* NPM */
  444. }
  445.  
  446. /*
  447.  *
  448.  */
  449. LVAL Xm_Graph_Widget_Class_Method_DESTROY_ALL_NODES()
  450. {
  451.   LVAL self;
  452.   Widget graph;
  453.  
  454.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  455.   xllastarg();
  456.  
  457.   XmGraphDestroyAllNodes(graph);
  458.  
  459.   return (self);            /* NPM */
  460. }
  461. /*
  462.  *
  463.  */
  464. LVAL Xm_Graph_Widget_Class_Method_DESTROY_SELECTED_ARCS_OR_NODES()
  465. {
  466.   LVAL self;
  467.   Widget graph;
  468.  
  469.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  470.   xllastarg();
  471.  
  472.   XmGraphDestroySelectedArcsOrNodes(graph);
  473.  
  474.   return (self);            /* NPM */
  475. }
  476. /*
  477.  *
  478.  */
  479. LVAL Xm_Graph_Widget_Class_Method_GET_ARCS()
  480. {
  481.   LVAL self;
  482.   Widget graph;
  483.   WidgetList alist;
  484.   int num_arcs;
  485.   
  486.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  487.   xllastarg();
  488.  
  489.   alist = XmGraphGetArcs(graph, &num_arcs);
  490.   return (Wcxmg_WidgetList_To_Lisp_Vector(alist, num_arcs));
  491. }
  492. /*
  493.  *
  494.  */
  495. LVAL Xm_Graph_Widget_Class_Method_GET_NODES()
  496. {
  497.   LVAL self;
  498.   Widget graph;
  499.   WidgetList nlist;
  500.   int n_nodes;
  501.   
  502.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  503.   xllastarg();
  504.  
  505.   nlist = XmGraphGetNodes (graph, &n_nodes);
  506.   return (Wcxmg_WidgetList_To_Lisp_Vector(nlist, n_nodes));
  507. }
  508. /*
  509.  *
  510.  */
  511. LVAL Xm_Graph_Widget_Class_Method_GET_ARCS_BETWEEN_NODES()
  512. {
  513.   LVAL self, f, t;
  514.   Widget graph;
  515.   Widget from, to;
  516.   WidgetList alist;
  517.   int num_arcs;
  518.   
  519.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  520.   from = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&f);
  521.   to = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&t);
  522.   xllastarg();
  523.  
  524.   alist = XmGraphGetArcsBetweenNodes (graph, from, to, &num_arcs);
  525.   return (Wcxmg_WidgetList_To_Lisp_Vector(alist, num_arcs));
  526. }
  527. /*
  528.  * returns a vector of values
  529.  */
  530. LVAL Xm_Graph_Widget_Class_Method_GET_NODE_ARCS()
  531. {
  532.   LVAL self, w, result, alistto, alistfrom;
  533.   Widget graph;
  534.   Widget widget;
  535.   int i, n_from, n_to;
  536.   WidgetList fromlist, tolist;
  537.   
  538.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  539.   widget = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&w);
  540.   xllastarg();
  541.  
  542.   XmGraphGetNodeArcs (graph, widget, &fromlist, &tolist, &n_from, &n_to);
  543.  
  544.   xlsave1(result);
  545.   result = newvector(4);
  546.   setelement(result, 0, Wcxmg_WidgetList_To_Lisp_Vector(fromlist, n_from));
  547.   setelement(result, 1, Wcxmg_WidgetList_To_Lisp_Vector(tolist, n_to));
  548.   setelement(result, 2, cvfixnum(n_from));
  549.   setelement(result, 3, cvfixnum(n_to));
  550.   xlpop();            /* NPM */
  551.   return (result);
  552. }
  553. /*
  554.  *
  555.  */
  556. LVAL Xm_Graph_Widget_Class_Method_GET_ROOTS()
  557. {
  558.   LVAL self;
  559.   Widget graph;
  560.   Widget node;
  561.   WidgetList rlist;
  562.   int num_nodes;
  563.   
  564.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  565.   xllastarg();
  566.  
  567.   rlist = XmGraphGetRoots (graph, &num_nodes);
  568.   return (Wcxmg_WidgetList_To_Lisp_Vector(rlist, num_nodes));
  569. }
  570. /*
  571.  *
  572.  */
  573. LVAL Xm_Graph_Widget_Class_Method_GET_SELECTED_ARCS()
  574. {
  575.   LVAL self;
  576.   Widget graph;
  577.   WidgetList alist;
  578.   int num_arcs;
  579.   
  580.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  581.   xllastarg();
  582.  
  583.   alist = XmGraphGetSelectedArcs (graph, &num_arcs);
  584.   return (Wcxmg_WidgetList_To_Lisp_Vector(alist, num_arcs));
  585. }
  586. /*
  587.  *
  588.  */
  589. LVAL Xm_Graph_Widget_Class_Method_GET_SELECTED_NODES()
  590. {
  591.   LVAL self;
  592.   Widget graph;
  593.   WidgetList nlist;
  594.   int num;
  595.   
  596.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  597.   xllastarg();
  598.  
  599.   nlist = XmGraphGetSelectedNodes (graph, &num);
  600.   return (Wcxmg_WidgetList_To_Lisp_Vector(nlist, num));
  601. }
  602. /*
  603.  *
  604.  */
  605. LVAL Xm_Graph_Widget_Class_Method_INPUT_OVER_ARC()
  606. {
  607.   extern LVAL Wcls_WidgetID_To_WIDGETOBJ(); /* w_classes.c */
  608.   LVAL self;
  609.   Widget graph;
  610.   int x_pos, y_pos;
  611.   
  612.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  613.   x_pos = (int) getfixnum(xlgafixnum());
  614.   y_pos = (int) getfixnum(xlgafixnum());
  615.   xllastarg();
  616.  
  617.   return (Wcls_WidgetID_To_WIDGETOBJ(XmGraphInputOverArc(graph, x_pos, y_pos)));
  618. }
  619. /*
  620.  *  FIX
  621.  */
  622. LVAL Xm_Graph_Widget_Class_Method_INSERT_ROOTS()
  623. {
  624. }
  625. /*
  626.  *
  627.  */
  628. LVAL Xm_Graph_Widget_Class_Method_IS_POINT_IN_ARC()
  629. {
  630.   LVAL self;
  631.   Widget arc;
  632.   int x, y;
  633.  
  634.   arc = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  635.   x = (int) getfixnum(xlgafixnum());
  636.   y = (int) getfixnum(xlgafixnum());
  637.   xllastarg();
  638.  
  639.   return (XmGraphIsPointInArc(arc, x, y) ? true : NIL);
  640. }
  641. /*
  642.  *
  643.  */
  644. LVAL Xm_Graph_Widget_Class_Method_IS_SELECTED_ARC()
  645. {
  646.   LVAL self, a;
  647.   Widget graph;
  648.   Widget arc;
  649.   
  650.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  651.   arc = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&a);
  652.   xllastarg();
  653.  
  654.   return (XmGraphIsSelectedArc(graph, arc)? true : NIL);
  655. }
  656. /*
  657.  *
  658.  */
  659. LVAL Xm_Graph_Widget_Class_Method_IS_SELECTED_NODE()
  660. {
  661.   LVAL self, w;
  662.   Widget graph;
  663.   Widget node;
  664.   
  665.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  666.   node = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&w);
  667.   xllastarg();
  668.  
  669.   return (XmGraphIsSelectedNode(graph, node) ? true : NIL);
  670. }
  671. /*
  672.  *
  673.  */
  674. LVAL Xm_Graph_Widget_Class_Method_MOVE_ARC()
  675. {
  676.   LVAL self, a, f, t;
  677.   Widget graph;
  678.   Widget arc;
  679.   Widget from, to;
  680.   Boolean rval;
  681.   
  682.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  683.   arc = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&a);
  684.   from = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&f);
  685.   to = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&t);
  686.   xllastarg();
  687.  
  688.   return (XmGraphMoveArc(graph, arc, from, to) ? true : NIL);
  689. }
  690. /*
  691.  *
  692.  */
  693. LVAL Xm_Graph_Widget_Class_Method_MOVE_NODE()
  694. {
  695.   LVAL self, n, f, t;
  696.   Widget graph;
  697.   Widget node, from, to;
  698.  
  699.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  700.   node = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&n);
  701.   from = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&f);
  702.   to = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&t);
  703.   xllastarg();
  704.  
  705.   return (XmGraphMoveNode(graph, node, from, to) ? true : NIL);
  706. }
  707. /*
  708.  *
  709.  */
  710. LVAL Xm_Graph_Widget_Class_Method_NUM_ARCS()
  711. {
  712.   LVAL self;
  713.   Widget graph;
  714.   
  715.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  716.   xllastarg();
  717.  
  718.   return (cvfixnum((FIXTYPE) XmGraphNumArcs(graph)));
  719. }
  720. /*
  721.  *
  722.  */
  723. LVAL Xm_Graph_Widget_Class_Method_NUM_NODES()
  724. {
  725.   LVAL self;
  726.   Widget graph;
  727.   
  728.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  729.   xllastarg();
  730.  
  731.   return (cvfixnum((FIXTYPE) XmGraphNumNodes(graph)));
  732. }
  733. /*
  734.  *  returns a vector of two values
  735.  */
  736. LVAL Xm_Graph_Widget_Class_Method_NUM_NODE_ARCS()
  737. {
  738.   LVAL self, w, result;
  739.   Widget graph;
  740.   Widget node;
  741.   int n_from, n_to;
  742.  
  743.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  744.   node = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&w);
  745.   xllastarg();
  746.  
  747.   XmGraphNumNodeArcs (graph, w, &n_from, &n_to);
  748.  
  749.   xlsave1(result);
  750.   result = newvector(2);
  751.   setelement(result, 0, cvfixnum(n_from));
  752.   setelement(result, 1, cvfixnum(n_to));
  753.   xlpop();            /* NPM */
  754.   return (result);
  755. }
  756. /*
  757.  *
  758.  */
  759. LVAL Xm_Graph_Widget_Class_Method_NUM_ROOTS()
  760. {
  761.   LVAL self;
  762.   Widget graph;
  763.   
  764.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  765.   xllastarg();
  766.  
  767.   return (cvfixnum((FIXTYPE) XmGraphNumRoots(graph)));
  768. }
  769. /*
  770.  *
  771.  */
  772. LVAL Xm_Graph_Widget_Class_Method_NUM_SELECTED_ARCS()
  773. {
  774.   LVAL self;
  775.   Widget graph;
  776.   
  777.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  778.   xllastarg();
  779.  
  780.   return (cvfixnum((FIXTYPE) XmGraphNumSelectedArcs(graph)));
  781. }
  782. /*
  783.  *
  784.  */
  785. LVAL Xm_Graph_Widget_Class_Method_NUM_SELECTED_NODES()
  786. {
  787.   LVAL self;
  788.   Widget graph;
  789.   
  790.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  791.   xllastarg();
  792.  
  793.   return (cvfixnum((FIXTYPE) XmGraphNumSelectedNodes(graph)));
  794. }
  795. /*
  796.  *
  797.  */
  798. LVAL Xm_Graph_Widget_Class_Method_MOVE_ALL()
  799. {
  800.   LVAL self;
  801.   Widget graph;
  802.   int delta_x, delta_y;
  803.   
  804.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  805.   delta_x = (int) getfixnum(xlgafixnum());
  806.   delta_y = (int) getfixnum(xlgafixnum());
  807.   xllastarg();
  808.  
  809.   XmGraphMoveAll(graph, delta_x, delta_y);
  810.  
  811.   return (self);            /* NPM */
  812. }
  813. /*
  814.  *
  815.  */
  816. LVAL Xm_Graph_Widget_Class_Method_LAYOUT()
  817. {
  818.   LVAL self;
  819.   Widget graph;
  820.   
  821.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  822.   xllastarg();
  823.  
  824.   XmGraphLayout(graph);
  825.  
  826.   return (self);            /* NPM */
  827. }
  828. /*
  829.  *
  830.  */
  831. LVAL Xm_Graph_Widget_Class_Method_RELAY_SUBGRAPH()
  832. {
  833.   LVAL self, w;
  834.   Widget graph;
  835.   Widget node;
  836.  
  837.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  838.   node = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&w);
  839.   xllastarg();
  840.  
  841.   XmGraphRelaySubgraph(graph, node);
  842.  
  843.   return (self);            /* NPM */
  844. }
  845. /*
  846.  *
  847.  */
  848. LVAL Xm_Graph_Widget_Class_Method_REMOVE_ARC_BETWEEN_NODES()
  849. {
  850.   LVAL self, w1, w2;
  851.   Widget graph;
  852.   Widget widget1, widget2;
  853.   
  854.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  855.   widget1 = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&w1);
  856.   widget2 = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&w2);
  857.   xllastarg();
  858.  
  859.   XmGraphRemoveArcBetweenNodes(graph, widget1, widget2);
  860.  
  861.   return (self);            /* NPM */
  862. }
  863. /*
  864.  * FIX: 
  865.  */
  866. LVAL Xm_Graph_Widget_Class_Method_REMOVE_ROOTS()
  867. {
  868.  /*
  869.   XmGraphRemoveRoots (graph, nodes, n_nodes);
  870.  */
  871. }
  872. /*
  873.  *
  874.  */
  875. LVAL Xm_Graph_Widget_Class_Method_SELECT_ARC()
  876. {
  877.   LVAL self, a;
  878.   Widget graph;
  879.   Widget arc;
  880.  
  881.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  882.   arc = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&a);
  883.   xllastarg();
  884.  
  885.   XmGraphSelectArc (graph, arc);
  886.  
  887.   return (self);            /* NPM */
  888. }
  889.  
  890. /*
  891.  *  FIX: 
  892.  */
  893. LVAL Xm_Graph_Widget_Class_Method_SELECT_ARCS()
  894. {
  895. /*
  896.   XmGraphSelectArcs (graph, arcs, n_arcs);
  897.  */
  898. }
  899.  
  900. /*
  901.  *  FIX
  902.  */
  903. LVAL Xm_Graph_Widget_Class_Method_SELECT_NODES()
  904. {
  905. }
  906.  
  907. /*
  908.  *
  909.  */
  910. LVAL Xm_Graph_Widget_Class_Method_UNSELECT_ARC()
  911. {
  912.   LVAL self, a;
  913.   Widget graph;
  914.   Widget arc;
  915.  
  916.   graph = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  917.   arc = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&a);
  918.   xllastarg();
  919.  
  920.   XmGraphUnselectArc (graph, arc); 
  921.  
  922.   return (self);            /* NPM */
  923. }
  924.  
  925. /*
  926.  *  FIX:
  927.  */
  928. LVAL Xm_Graph_Widget_Class_Method_UNSELECT_ARCS()
  929. {
  930. /*
  931.   XmGraphUnselectArcs (graph, arcs, n_arcs);
  932. */
  933. }
  934.  
  935. /*
  936.  *  FIX
  937.  */
  938. LVAL Xm_Graph_Widget_Class_Method_UNSELECT_NODES()
  939. {
  940. /*
  941.   XmGraphUnselectNodes (graph, nodes, n_nodes);
  942. */
  943. }
  944.  
  945. /*
  946.  * (send <graph_widget> :select_node <node_widget>)
  947.  */
  948. LVAL Xm_Graph_Widget_Class_Method_SELECT_NODE ()
  949. {
  950.   LVAL self, node;
  951.   Widget graph_widget;
  952.   Widget node_widget;
  953.  
  954.   graph_widget = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  955.   node_widget = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&node);
  956.   xllastarg();
  957.  
  958.   XmGraphSelectNode(graph_widget, node_widget);
  959.  
  960.   return (self);            /* NPM */
  961. }
  962.  
  963. /*
  964.  * (send <graph_widget> :unselect_node <node_widget>)
  965.  */
  966. LVAL Xm_Graph_Widget_Class_Method_UNSELECT_NODE ()
  967. {
  968.   LVAL self, node;
  969.   Widget graph_widget;
  970.   Widget node_widget;
  971.   
  972.   graph_widget = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  973.   node_widget = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&node);
  974.   xllastarg();
  975.  
  976.   XmGraphUnselectNode(graph_widget, node_widget);
  977.  
  978.   return (self);            /* NPM */
  979. }
  980.  
  981. /******************************************************************************
  982.  *
  983.  ******************************************************************************/
  984. Wc_XmGraph_Init()
  985. {
  986.   LVAL o_XM_GRAPH_WIDGET_CLASS;
  987.   LVAL o_XM_ARC_WIDGET_CLASS;
  988.   extern LVAL Wcls_Create_Subclass_Of_WIDGET_CLASS(); /* w_classes.c */
  989.   extern      xladdmsg();    /* from xlobj.c */
  990.   
  991.   /******************************* GRAPH WIDGET *********************************/
  992.   o_XM_GRAPH_WIDGET_CLASS =
  993.     Wcls_Create_Subclass_Of_WIDGET_CLASS("XM_GRAPH_WIDGET_CLASS",
  994.                      xmGraphWidgetClass);
  995.  
  996.   /* a special :isnew method on this class allows for the creation of this
  997.      widget inside a scrolled window if the submessage keyword :scrolled 
  998.      is given ... */
  999.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":ISNEW", 
  1000.        FTAB_Xm_Graph_Widget_Class_Method_ISNEW);
  1001.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":ADD_CALLBACK", 
  1002.        FTAB_Xm_Graph_Widget_Class_Method_ADD_CALLBACK);
  1003.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":SET_CALLBACK", 
  1004.        FTAB_Xm_Graph_Widget_Class_Method_SET_CALLBACK);
  1005.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":CENTER_AROUND_WIDGET",
  1006.        FTAB_Xm_Graph_Widget_Class_Method_CENTER_AROUND_WIDGET);
  1007.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":DESTROY_ALL_ARCS",
  1008.        FTAB_Xm_Graph_Widget_Class_Method_DESTROY_ALL_ARCS);
  1009.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":DESTROY_ALL_NODES",
  1010.        FTAB_Xm_Graph_Widget_Class_Method_DESTROY_ALL_NODES);
  1011.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":DESTROY_SELECTED_ARCS_OR_NODES",
  1012.        FTAB_Xm_Graph_Widget_Class_Method_DESTROY_SELECTED_ARCS_OR_NODES);
  1013.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":GET_ARCS",
  1014.        FTAB_Xm_Graph_Widget_Class_Method_GET_ARCS);
  1015.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":GET_NODES",
  1016.        FTAB_Xm_Graph_Widget_Class_Method_GET_NODES);
  1017.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":GET_ARCS_BETWEEN_NODES",
  1018.        FTAB_Xm_Graph_Widget_Class_Method_GET_ARCS_BETWEEN_NODES);
  1019.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":GET_NODE_ARCS",
  1020.        FTAB_Xm_Graph_Widget_Class_Method_GET_NODE_ARCS);
  1021.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":GET_ROOTS",
  1022.        FTAB_Xm_Graph_Widget_Class_Method_GET_ROOTS);
  1023.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":GET_SELECTED_ARCS",
  1024.        FTAB_Xm_Graph_Widget_Class_Method_GET_SELECTED_ARCS);
  1025.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":GET_SELECTED_NODES",
  1026.        FTAB_Xm_Graph_Widget_Class_Method_GET_SELECTED_NODES);
  1027.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":INPUT_OVER_ARC",
  1028.        FTAB_Xm_Graph_Widget_Class_Method_INPUT_OVER_ARC);
  1029.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":INSERT_ROOTS",
  1030.        FTAB_Xm_Graph_Widget_Class_Method_INSERT_ROOTS);
  1031.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":IS_POINT_IN_ARC",
  1032.        FTAB_Xm_Graph_Widget_Class_Method_IS_POINT_IN_ARC);
  1033.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":IS_SELECTED_ARC",
  1034.        FTAB_Xm_Graph_Widget_Class_Method_IS_SELECTED_ARC);
  1035.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":IS_SELECTED_NODE",
  1036.        FTAB_Xm_Graph_Widget_Class_Method_IS_SELECTED_NODE);
  1037.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":MOVE_ARC",
  1038.        FTAB_Xm_Graph_Widget_Class_Method_MOVE_ARC);
  1039.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":MOVE_NODE",
  1040.        FTAB_Xm_Graph_Widget_Class_Method_MOVE_NODE);
  1041.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, "NUM_ARCS:",
  1042.        FTAB_Xm_Graph_Widget_Class_Method_NUM_ARCS);
  1043.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":NUM_NODES",
  1044.        FTAB_Xm_Graph_Widget_Class_Method_NUM_NODES);
  1045.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":NUM_NODE_ARCS",
  1046.        FTAB_Xm_Graph_Widget_Class_Method_NUM_NODE_ARCS);
  1047.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":NUM_ROOTS",
  1048.        FTAB_Xm_Graph_Widget_Class_Method_NUM_ROOTS);
  1049.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":NUM_SELECTED_ARCS",
  1050.        FTAB_Xm_Graph_Widget_Class_Method_NUM_SELECTED_ARCS);
  1051.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":NUM_SELECTED_NODES",
  1052.        FTAB_Xm_Graph_Widget_Class_Method_NUM_SELECTED_NODES);
  1053.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":MOVE_ALL",
  1054.        FTAB_Xm_Graph_Widget_Class_Method_MOVE_ALL);
  1055.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":LAYOUT",
  1056.        FTAB_Xm_Graph_Widget_Class_Method_LAYOUT);
  1057.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":RELAY_SUBGRAPH",
  1058.        FTAB_Xm_Graph_Widget_Class_Method_RELAY_SUBGRAPH);
  1059.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":REMOVE_ARC_BETWEEN_NODES",
  1060.        FTAB_Xm_Graph_Widget_Class_Method_REMOVE_ARC_BETWEEN_NODES);
  1061.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":REMOVE_ROOTS",
  1062.        FTAB_Xm_Graph_Widget_Class_Method_REMOVE_ROOTS);
  1063.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":SELECT_ARC",
  1064.        FTAB_Xm_Graph_Widget_Class_Method_SELECT_ARC);
  1065.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":SELECT_ARCS",
  1066.        FTAB_Xm_Graph_Widget_Class_Method_SELECT_ARCS);
  1067.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":SELECT_NODE", 
  1068.        FTAB_Xm_Graph_Widget_Class_Method_SELECT_NODE);
  1069.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":SELECT_NODES", 
  1070.        FTAB_Xm_Graph_Widget_Class_Method_SELECT_NODES);
  1071.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":UNSELECT_ARC",
  1072.        FTAB_Xm_Graph_Widget_Class_Method_UNSELECT_ARC);
  1073.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":UNSELECT_ARCS",
  1074.        FTAB_Xm_Graph_Widget_Class_Method_UNSELECT_ARCS);
  1075.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":UNSELECT_NODE", 
  1076.        FTAB_Xm_Graph_Widget_Class_Method_UNSELECT_NODE);
  1077.   xladdmsg(o_XM_GRAPH_WIDGET_CLASS, ":UNSELECT_NODES", 
  1078.        FTAB_Xm_Graph_Widget_Class_Method_UNSELECT_NODES);
  1079.  
  1080.   /******************************** ARC WIDGET **********************************/
  1081.   o_XM_ARC_WIDGET_CLASS =
  1082.     Wcls_Create_Subclass_Of_WIDGET_CLASS("XM_ARC_WIDGET_CLASS",
  1083.                      xmArcWidgetClass);
  1084.  
  1085.   /* A special :isnew method on this class overrides default Xt widget creation  
  1086.      routine on meta-class WIDGET_CLASS. We need to call special creator XmCreateArc(). */
  1087.   xladdmsg(o_XM_ARC_WIDGET_CLASS, ":ISNEW", 
  1088.        FTAB_Xm_Arc_Widget_Class_Method_ISNEW);
  1089.   
  1090.   s_CALLBACK_SELECTED_WIDGETS = xlenter("CALLBACK_SELECTED_WIDGETS");
  1091.   s_CALLBACK_NUM_SELECTED_WIDGETS = xlenter ("CALLBACK_NUM_SELECTED_WIDGETS");
  1092.   s_CALLBACK_SELECTED_ARCS = xlenter("CALLBACK_SELECTED_ARCS");
  1093.   s_CALLBACK_NUM_SELECTED_ARCS = xlenter("CALLBACK_NUM_SELECTED_ARCS");
  1094.   s_CALLBACK_OLD_TO = xlenter("CALLBACK_OLD_TO");
  1095.   s_CALLBACK_OLD_FROM = xlenter("CALLBACK_OLD_FROM");
  1096.   s_CALLBACK_NEW_TO = xlenter("CALLBACK_NEW_TO");
  1097.   s_CALLBACK_NEW_FROM = xlenter("CALLBACK_NEW_FROM");
  1098. }
  1099.